﻿@model sBlog.Net.Models.Comments.CommentViewModel

<script>
    $(document).ready(function () {
        $('.input').focus(function () {
            $(this).parent().children("span").animate({ opacity: 0.7, left: -($(this).parent().children("span").width()) - 10 + "px" }, { duration: 0 });
        });
        $('.spaninput').click(function () {
            $(this).animate({ opacity: 0.3, left: -($(this).parent().children("span").width()) - 10 + "px" }, { duration: 0 });
            $(this).parent().children("input").focus();
        });
        $('.input').blur(function () {
            if ($(this).val() == "") {
                $(this).parent().children("span").animate({ opacity: 1, left: "15px" }, { duration: 0 });
            } else {
                $(this).parent().children("span").animate({ opacity: 0 }, { duration: 0 });
            }
        });

        $('.input').each(function () {
            if ($(this).val() != "") {
                $(this).focus();
            }
        });

    });

    function clearError() {
        $('div.comment-errors').hide();
        $('.error').removeClass('error');
        $("#cError").text('');
        $('#cSuc').hide();
        $('#cError').hide();
    }
    function showError(id, errorMessage) {
        if (document.getElementById("cError").innerHTML == "") {
            document.getElementById("cError").innerHTML = errorMessage;
            $('#cError').css('visibility', 'visible').hide().fadeIn(650);
            $('#contact').animate({ paddingTop: "60px" }, 250);
        }
        else {
            //document.getElementById("cError").innerHTML = document.getElementById("cError").innerHTML + errorMessage
        }
        //if (document.getElementById(id).value == "" && id == "bericht") {
        // document.getElementById(id).value = "UW BERICHT, VRAAG OF OPMERKING...";
        //}
        if (document.getElementById(id)) {
            document.getElementById(id).className = "error";
        }
    }
</script>


<span class="post-comment">@ViewRes.SharedStrings.PostYourCommentStr</span>
<br /><br />

@Html.Partial("CommentAddStatus")

@using (Html.BeginForm("Add", "Comment", FormMethod.Post, new { id="userComment",style="userCommentForm" }))
{
    <div id="cError"></div>
    <div>
    @*<div style="margin-left: 50px;">*@
        @if (!Request.IsAuthenticated)
        {
            @*<div class="editor-label">
                <b>@ViewRes.SharedStrings.NameLabelStr <span class="required-field">(*)</span><span class="required-field-info">&nbsp;- @ViewRes.SharedStrings.RequiredFieldStr</span></b>
            </div>*@
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Comment.CommentUserFullName, new { @class = "input inputBoxBig required-box validate-html", autocomplete = "off" })
                <span class="spaninput" style="opacity: 1; left: 15px;">Имя*</span>
            </div>
            @*<div class="editor-label">
                <b>@ViewRes.SharedStrings.EmailLabelStr <span class="required-field">(*)</span><span class="required-field-info">&nbsp;- @ViewRes.SharedStrings.RequiredFieldStr</span></b>
            </div>*@
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Comment.CommenterEmail, new { @class = "input inputBoxBig required-box validate-html", autocomplete = "off" })
                <span class="spaninput" style="opacity: 1; left: 15px;">E-mail*</span>
            </div>@*
            <div class="editor-label">
                <b>@ViewRes.SharedStrings.SiteAdresLabelStr </b>
            </div>*@
            <div class="editor-field">
                @Html.TextBoxFor(model => model.Comment.CommenterSite, new { @class = "input inputBoxBig validate-html", autocomplete = "off" })
                  <span class="spaninput" style="opacity: 1; left: 15px;">WEB сайт</span>
            </div>
        }
        else
        {
            @Html.HiddenFor(model => model.Comment.CommentUserFullName)
            @Html.HiddenFor(model => model.Comment.CommenterEmail)
            @Html.HiddenFor(model => model.Comment.CommenterSite)
        }
        @*<div class="editor-label">
            <b>@ViewRes.SharedStrings.YourCommentStr <span class="required-field">(*)</span><span class="required-field-info">&nbsp;- @ViewRes.SharedStrings.RequiredFieldStr</span></b>
        </div>*@
        <div class="editor-field bigtext">
            @Html.TextAreaFor(model => model.Comment.CommentContent, new { @class = "inputBoxBigTextArea required-box validate-html", @rows = 10 })
        </div>
        
        @if (!Request.IsAuthenticated)
        {
            <div class="editor-label misc-field-lbl">
                <span></span>
            </div>
            <div class="editor-field  misc-field">
                
            </div>
            <div id="user-tests">
                <label for="DisplayName">Enter your name again:</label>
                <input type="text" id="DisplayName" name="DisplayName" value=""/>
            </div>
        }

        @Html.HiddenFor(model => model.Post.PostID)
        @Html.HiddenFor(model => model.Post.PostTitle)
        @Html.HiddenFor(model => model.Post.PostUrl)
        @Html.HiddenFor(model => model.Post.PostAddedDate)
        @Html.HiddenFor(model => model.Post.EntryType)
	
        <p>
            <input type="submit" value="@ViewRes.SharedStrings.PostYourCommentStr" class="anonymous-comment submitBtn" />
            @*<span class="required-field">(*)</span> - @ViewRes.SharedStrings.RequiredStr*@
        </p>
    </div>
}
